package top.haloiti.learnning.singletonDoubleCheck;

/**
 * @Auther: 乔帅
 * @Date: 2020/9/13 15:24
 * @Description: 懒汉式 双重锁
 */
public class LazyDoubleCheckSingleton {
    private volatile static LazyDoubleCheckSingleton lazyDoubleCheckSingleton = null;

    private LazyDoubleCheckSingleton() {
    }

    // 对外提供获取实例的访问点
    public static LazyDoubleCheckSingleton getInstance() {
        if (lazyDoubleCheckSingleton == null) {
            synchronized (LazyDoubleCheckSingleton.class) {
                lazyDoubleCheckSingleton = new LazyDoubleCheckSingleton();
            }

        }
        return lazyDoubleCheckSingleton;
    }
}
